package com.zx.common.entity;

import java.util.Date;

public class User2 implements Comparable<User2> {

    private Integer id;

    private int age = 10;

    private String name;

    private Date birtday;

    public User2() {
    }

    public User2(final Integer id, final String name, final Date birtday) {
        this.id = id;
        this.name = name;
        this.birtday = birtday;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Integer getId() {
        return this.id;
    }

    public void setId(final Integer id) {
        this.id = id;
    }

    public String getName() {
        return this.name;
    }

    public void setName(final String name) {
        this.name = name;
    }

    public Date getBirtday() {
        return this.birtday;
    }

    public void setBirtday(final Date birtday) {
        this.birtday = birtday;
    }

    @Override
    public String toString() {
        return "User [id=" + this.id + ", name=" + this.name + ", birtday=" + this.birtday + "]";
    }

    @Override
    public int compareTo(final User2 o) {
        return this.getName().compareTo(o.getName());
    }

	/*public int compareTo(User user) {
	    return ComparisonChain.start()
	    		//对可排序类型做自然排序，如数字按大小，日期按先后排序
	            .compare(this.id, user.getId(), Ordering.natural())
	            //按对象的字符串形式做字典排序[lexicographical ordering]
	            .compare(this.name, user.getName(), Ordering.usingToString())
	            //把给定的Comparator转化为排序器
	            .compare(this.birtday, user.getBirtday(), Ordering.natural().nullsLast())
	            .result();
	}*/

}
